from PyQt5.QtCore import QObject , pyqtSignal

class QTypeSignal(QObject):
    sendmsg = pyqtSignal(object)
    def __init__(self):
        super(QTypeSignal,self).__init__()
    def run(self):
        self.sendmsg.emit("Hello Pyqt5")
class QTypeSlot(QObject):
    def __init__(self):
        super(QTypeSlot,self).__init__()
    def get(self,msg):
        print("QSlot get msg=>"+msg)


## 可以发送多个信号
## 本质就是接收信号,处理信号的任务，如是是闭环则还有发出信号的任务
if __name__ == "__main__":
    send = QTypeSignal()
    slot = QTypeSlot()
    print("---信号绑定到槽上---")
    send.sendmsg.connect(slot.get)
    send.run()
    print("---信号脱离槽上---")
    send.sendmsg.disconnect(slot.get)
    send.run()